package com.ly.airline.utils;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ：xxl
 * @ClassName NewPaginationInnerInterceptor
 * @date ：Created in 2022/3/17 14:12
 * @description： 分页删除最后一页所有记录后，跳转到最后页（默认实现是跳转到首页）
 * @modified By：
 * @version: 1.0
 */
@Data
@NoArgsConstructor
public class NewPaginationInnerInterceptor extends PaginationInnerInterceptor {

    private DbType dbType;

    public NewPaginationInnerInterceptor(DbType dbType){
        this.dbType = dbType;
    }

    @Override
    protected void handlerOverflow(IPage<?> page) {
        page.setCurrent(page.getPages());
    }
}
